using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MultiTabBrowser
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnTab_Click(object sender, EventArgs e)
        {
            
            TabPage tpNew = new TabPage();
            tpNew.Location = new System.Drawing.Point(4, 22);
            tpNew.Name = "blank";
            tpNew.Padding = new System.Windows.Forms.Padding(3);
            tpNew.Size = new System.Drawing.Size(435, 268);
            tpNew.TabIndex = tabControl1.TabCount;
            tpNew.Text = "Blank";
            tpNew.UseVisualStyleBackColor = true;

            WebBrowser wbNew = new WebBrowser();
            wbNew.Dock = System.Windows.Forms.DockStyle.Fill;
            wbNew.Location = new System.Drawing.Point(3, 3);
            wbNew.MinimumSize = new System.Drawing.Size(20, 20);
            wbNew.Size = new System.Drawing.Size(429, 262);
            wbNew.Url = new System.Uri("http://www.google.com.au", System.UriKind.Absolute);

            tpNew.Controls.Add(wbNew);
            tabControl1.TabPages.Add(tpNew);            
        }

        private void btnGO_Click(object sender, EventArgs e)
        {
            WebBrowser wbb;
            wbb = (WebBrowser)tabControl1.SelectedTab.Controls[0];
            if (tbxURL.Text != "")
            {
                try
                {
                    wbb.Url = new Uri(tbxURL.Text);
                    //Uri uri = new Uri("firstpath");
                    //string result = Convert.ToString(uri.MakeRelativeUri(new Uri("secondpath")));
                }
                catch (UriFormatException ufe) {
                    try
                    {
                        wbb.Url = new Uri(@"http://" + tbxURL.Text);
                    }
                    catch (UriFormatException ufe2) { }
                }
            }
          
        }



       
    }
}